/**
 * @Author: aesoper
 * @Description:
 * @File:  convert
 * @Version: 1.0.0
 * @Date: 2020/6/21 13:28
 */

package utils

import (
	"github.com/axgle/mahonia"
	"strings"
)

// 字符串转布尔值
func ConvertStringToBool(str string) bool {
	return strings.ToLower(str) == "true"
}

// 布尔值转字符串
func ConvertBoolToString(b bool) string {
	if b {
		return "true"
	}
	return "false"
}

// GBK编码转换为UTF8
func GBK2UTF8(s string) string {
	dec := mahonia.NewDecoder("gbk")
	return dec.ConvertString(s)
}
